package com.yidu.service.impl;

import java.util.List;

import javax.annotation.Resource;

import org.apache.log4j.Logger;
import org.springframework.stereotype.Service;
import org.springframework.util.StringUtils;

import com.alibaba.druid.support.spring.stat.SpringStatUtils;
import com.yidu.bean.TbManager;
import com.yidu.dao.TbManagerMapper;
import com.yidu.message.Page;
import com.yidu.message.Pages;
import com.yidu.service.TbManagerService;

/**
 * 类的描述-- 后台用户
 * @author 楠竹
 * @date 2018年7月22日
 * @version 1.0
 */
@Service
public class TbManagerServiceImpl implements TbManagerService {

	@Resource
	private TbManagerMapper managerDao;
	
	//打印
	Logger logger  = Logger.getLogger(TbManagerServiceImpl.class);
	/* (non-Javadoc)
	 * @see com.yidu.service.TbManagerService#delete(java.lang.String)
	 */
	@Override
	public int delete(String manId) {

		logger.info("进入删除方法...");
		int num  = managerDao.deleteByPrimaryKey(manId);
		return num;
	}

	/* (non-Javadoc)
	 * @see com.yidu.service.TbManagerService#save(com.yidu.bean.TbManager)
	 */
	@Override
	public int save(TbManager man) {
		logger.info("进入增加方法...");
		int num = managerDao.insertSelective(man);
		return num;
	}

	/* (non-Javadoc)
	 * @see com.yidu.service.TbManagerService#update(com.yidu.bean.TbManager)
	 */
	@Override
	public int update(TbManager man) {
		 logger.info("进入修改方法...");
		 int num = managerDao.updateByPrimaryKey(man);
		return num;
	}

	/* (non-Javadoc)
	 * @see com.yidu.service.TbManagerService#findVague(com.yidu.message.Page, com.yidu.bean.TbManager)
	 */
	@Override
	public List<TbManager> findVague(Pages pages, TbManager man) { 
		logger.info("进入模糊查询...");
		List<TbManager> num = managerDao.findVague(man, pages);
		return num;
	}



	@Override
	public int isLogin(TbManager man) {
		// TODO Auto-generated method stub
		return managerDao.isLogin(man);
	}

	@Override
	public TbManager findBy(TbManager man) {

		TbManager mans = managerDao.findBy(man);
		return mans;
	}

	@Override
	public int findByCount(TbManager man) {
		logger.info("进入查询结果集...");
		int nunm  = managerDao.findByCount(man);
		return nunm;
	}

	@Override
	public TbManager findById(String manId) {
		 logger.info("进入根据id查询...");
		 TbManager man = managerDao.selectByPrimaryKey(manId);
		return man;
	}

}
